package com.pxx.item.controller;

import com.pxx.item.pojo.SpuBo;
import com.pxx.item.service.TbSpuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * @author : Yoo19
 * @description :
 * @createDate : 2025/6/27 19:03 03
 */
@RestController
@RequestMapping("/item")
public class GoodsController {
    @Autowired
    private TbSpuService tbSpuService;

    /**
     * 添加商品
     * @param spuBo
     * @return
     */
    @PostMapping("goods")
    public ResponseEntity<Void> addGoods(@RequestBody SpuBo spuBo) {
        tbSpuService.addGoods(spuBo);
        return new ResponseEntity<>(HttpStatus.OK);
    }

    @PutMapping("goods")
    public ResponseEntity<Void> updateGoods(@RequestBody SpuBo spuBo){
        tbSpuService.updateGoods(spuBo);
//        tbSpuService.addGoods(spuBo);
        return new ResponseEntity<>(HttpStatus.OK);
    }
}
